#ifndef CIRCUITSIMSYSTEM_H
#define CIRCUITSIMSYSTEM_H

#include "../ecs/system.h"
#include "../entities/pinentity.h"

// CircuitSimSystem
// check circuits state in lifetime.

class CircuitSimSystem: public System
{
public:
    CircuitSimSystem(QObject* parent = nullptr);
    void tick(const int& msec) override;

private:
    // check whole circuit working state on theirs lifetime.
    void checkCircuitState();

    // find valid current pin sequence from unoBoard's pins
    void findValidLines();

    // recurse pins
    void findNodes(QList<int>& line, const int& pinID);

    // store valid current pin sequence.
    QList<QList<int>> mValidCurrentLines;

    // store valid curent pin set(unique)
    QSet<int> mValidCurrentPinSet;
};

#endif // CIRCUITSIMSYSTEM_H
